-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bugs related to lammps PIMD #266
Conversation
Signed-off-by: zjgemi <[email protected]>
for more information, see https://pre-commit.ci
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
for more information, see https://pre-commit.ci
Signed-off-by: zjgemi <[email protected]>
Signed-off-by: zjgemi <[email protected]>
Signed-off-by: zjgemi <[email protected]>
📝 Walkthrough📝 Walkthrough📝 WalkthroughWalkthroughThe changes in this pull request involve modifications to the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
dpgen2/op/select_confs.py (1)
129-129
: Approve the improved conditional check with a minor suggestion.The change to
if optional_outputs and any(optional_outputs):
is a good improvement. It ensures thatoptional_outputs
not only exists but also contains at least one non-None value before processing. This prevents potential issues with empty lists or lists containing only None values.For even better clarity and to make the intent more explicit, consider using:
if optional_outputs and any(output is not None for output in optional_outputs):This version explicitly checks for non-None values, which aligns perfectly with the error handling in the following lines.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- dpgen2/op/run_lmp.py (1 hunks)
- dpgen2/op/select_confs.py (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
dpgen2/op/run_lmp.py (1)
198-199
: Approve: Correct indentation ofmerge_pimd_files()
The indentation change for the
merge_pimd_files()
function call is correct and necessary. This modification ensures that the PIMD (Path Integral Molecular Dynamics) files are merged within the proper working directory context, aligning with other operations in thewith set_directory(work_dir):
block.This change likely resolves a bug where PIMD files were not being merged in the intended directory. The added empty line after the function call improves code readability.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #266 +/- ##
==========================================
- Coverage 83.72% 83.70% -0.02%
==========================================
Files 104 104
Lines 6015 6015
==========================================
- Hits 5036 5035 -1
- Misses 979 980 +1 ☔ View full report in Codecov by Sentry. |
Signed-off-by: zjgemi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
dpgen2/op/collect_data.py (3)
98-98
: Approve the added safety check, but consider additional error handling.The addition of the
if ii and
condition is a good safeguard against potential errors whenii
is None or an empty value. This prevents runtime errors that could occur when trying to performrglob
on an invalid path.Consider adding logging or raising a custom exception when
ii
is falsy to help with debugging:if ii: if len(list(ii.rglob("fparam.npy"))) > 0: setup_ele_temp(False) else: logging.warning(f"Skipping fparam.npy check for invalid path: {ii}") # or # raise ValueError(f"Invalid path encountered: {ii}")This would provide more visibility into cases where
ii
is unexpectedly None or empty.
100-100
: Approve the added safety check and ensure consistent error handling.The addition of the
if ii and
condition here is consistent with the previous change and provides the same safeguard against potential errors whenii
is None or an empty value.For consistency, apply the same error handling approach as suggested for the
fparam.npy
check:if ii: if len(list(ii.rglob("aparam.npy"))) > 0: setup_ele_temp(True) else: logging.warning(f"Skipping aparam.npy check for invalid path: {ii}") # or # raise ValueError(f"Invalid path encountered: {ii}")This ensures consistent behavior and error reporting across both checks.
98-100
: Consider a broader review of error handling in the execute method.The changes to add safety checks for
ii
before performingrglob
operations are good improvements. However, it might be beneficial to conduct a broader review of howii
and other potential error cases are handled throughout theexecute
method.Consider the following suggestions:
- Implement consistent error handling and logging throughout the method.
- Review the
labeled_data
input to ensure it always contains valid paths.- Consider adding input validation at the beginning of the method to catch and handle potential issues early.
These steps would further improve the robustness and maintainability of the
CollectData
class.
Signed-off-by: zjgemi <[email protected]>
for more information, see https://pre-commit.ci
This reverts commit e3d03ce.
This reverts commit 7c36020.
Summary by CodeRabbit
Bug Fixes
Style